package com.ice.client.proto;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class ProtoClientConfig implements ApplicationRunner, DisposableBean {

    @Autowired
    private ProtobufClient protobufClient;



    @Override
    public void run(ApplicationArguments args) throws Exception {
        protobufClient.start();
        log.info("proto client 客户端启动");
    }

    @Override
    public void destroy() throws Exception {
        if (protobufClient != null) {
            this.protobufClient.stop();
        }
    }
}
